#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    int i = 0;
    int arr[4] = {0};

    int count = 0;
    int d_A = 0, d_B = 0;

    scanf("%d", &count);

    for(i = 0; i < count; i++)
    {
        int sum = 0;

        scanf("%d %d %d %d", &arr[0], &arr[1], &arr[2], &arr[3]);
        sum = arr[0] + arr[2];

        if(arr[1] == sum && arr[3] != sum)
            d_B++;
        else if( arr[3] == sum && arr[1] != sum )
            d_A++;
    }

    printf("%d %d", d_A, d_B);
    return 0;
}